﻿<Window x:Class="AutoLoL.Dialogs.ItemDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Item"
        Height="450"
        Width="850"
        Icon="/Icon.ico"
        WindowStartupLocation="CenterOwner">
    <DockPanel LastChildFill="True" Margin="10">
        <Grid DockPanel.Dock="Bottom" Margin="0 10 0 0">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/magnifier.png" />
                <TextBlock Margin="5 0 0 0" Text="Filter:" VerticalAlignment="Center" />
                <TextBox Width="300" Name="FilterTextBox" KeyDown="FilterTextBox_KeyDown" Margin="5 0 0 0" TextChanged="FilterTextBox_TextChanged" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
                <Button Name="SelectButton" Content="Select" Height="23" Width="75" Click="SelectButton_Click" />
                <Button Name="NoneButton" Content="None" Height="23" Width="75" Margin="10 0 0 0" Click="NoneButton_Click" />
                <Button Name="CancelButton" Content="Cancel" Height="23" Width="75" Margin="10 0 0 0" Click="CancelButton_Click" />
            </StackPanel>
        </Grid>
        <Grid DockPanel.Dock="Right" Width="150" Margin="10 0 0 0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#66D4D4D4" Offset="1"/>
                        <GradientStop Color="White" Offset="0.6"/>
                    </LinearGradientBrush>
                </Grid.Background>
                <ItemsControl Name="BuildsToItemsControl" Margin="0 0 0 5">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel FlowDirection="RightToLeft" IsItemsHost="True" VerticalAlignment="Bottom" HorizontalAlignment="Center" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Image Width="42" Height="42" Margin="0 0 5 5" Source="{Binding Path=IconBitmapImage}" Cursor="Hand" MouseLeftButtonDown="ItemImage_MouseLeftButtonDown">
                                <Image.ToolTip>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding Path=Name}" />
                                        <TextBlock Text=" (" />
                                        <TextBlock Text="{Binding Path=Total}" />
                                        <TextBlock Text=")" />
                                    </StackPanel>
                                </Image.ToolTip>
                            </Image>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Grid>
            <Image Grid.Row="1" Height="52" Width="52" Margin="5" Source="{Binding ElementName=ItemsDataGrid, Path=SelectedItem.IconBitmapImage}">
                <!--<Image.ToolTip>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ElementName=ItemsDataGrid, Path=SelectedItem.Name}" />
                        <TextBlock Text=" (" />
                        <TextBlock Text="{Binding ElementName=ItemsDataGrid, Path=SelectedItem.Total}" />
                        <TextBlock Text=")" />
                    </StackPanel>
                </Image.ToolTip>-->
            </Image>
            <Grid Grid.Row="2">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#66D4D4D4" Offset="0"/>
                        <GradientStop Color="White" Offset="0.4"/>
                    </LinearGradientBrush>
                </Grid.Background>
                <ItemsControl Name="BuiltFromItemsControl" Margin="0 10 0 0">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel IsItemsHost="True" VerticalAlignment="Top" HorizontalAlignment="Center" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Image Width="42" Height="42" Margin="0 0 5 5" Source="{Binding Path=IconBitmapImage}" Cursor="Hand" MouseLeftButtonDown="ItemImage_MouseLeftButtonDown">
                                <Image.ToolTip>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding Path=Name}" />
                                        <TextBlock Text=" (" />
                                        <TextBlock Text="{Binding Path=Total}" />
                                        <TextBlock Text=")" />
                                    </StackPanel>
                                </Image.ToolTip>
                            </Image>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Grid>
        </Grid>
        <DataGrid Name="ItemsDataGrid" RowHeaderWidth="0" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" SelectionMode="Single" SelectionUnit="FullRow" AutoGenerateColumns="False" SelectionChanged="ItemsDataGrid_SelectionChanged" LoadingRow="ItemsDataGrid_LoadingRow" UnloadingRow="ItemsDataGrid_UnloadingRow">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="" Width="38">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Width="32" Height="32" Source="{Binding Path=IconBitmapImage}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Name" Width="130">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Margin="3" VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Description" Width="*">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="3" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Price" Width="40">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Price}" TextWrapping="Wrap" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Total" Width="40">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Total}" TextWrapping="Wrap" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Window>